using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Com.queryzer2.Domain;
using System.Collections.Generic;
using Com.queryzer2.Domain.Entities;
using Com.AlbLab.CR.Web.Pratiche;
namespace common
{
    public class ToGenericListTransformers
    {
        public static IList<GenericListDTO> transform(IList<GEP_FASE> dataList)
        {
            IList<GenericListDTO> l = new List<GenericListDTO>();
            foreach (GEP_FASE e in dataList)
            {
                l.Add(new GenericListDTO(e.Fas_Id.ToString(),e.Fas_Progr_Fase.ToString(), e.Fas_des_fase, e.Fas_Unit_Oper, e.Fas_Dt_Arrivo.Value.ToShortDateString(), (e.Fas_Dt_Finelav.HasValue?e.Fas_Dt_Finelav.Value.ToShortDateString():null),null, null, null));
            }
            return l;
        }

        public static IList<GenericListDTO> transform(IList<PraticaBase> dataList)
        {
            int i;
            i = 1;
            IList<GenericListDTO> l = new List<GenericListDTO>();
            foreach (PraticaBase e in dataList)
            {
                l.Add(new GenericListDTO(i.ToString(), e.CodiceServizio, e.CodiceFlusso, e.DescrizioneServizio, e.TipoPratica, e.PraticaAmmisibile, e.DesCodInam, e.NoteInam, null));
                i=i+1;
                //l.Add(new GenericListDTO(e.Fas_Id.ToString(), e.Fas_des_fase, e.Fas_Unit_Oper, e.Fas_Dt_Arrivo.Value.ToShortDateString(), (e.Fas_Dt_Finelav.HasValue ? e.Fas_Dt_Finelav.Value.ToShortDateString() : null), null, null, null, null));
            }
            return l;
        }

        public static IList<GenericListDTO> transform(List<GEP_TESTATA> dataList)
        {
            IList<GenericListDTO> l = new List<GenericListDTO>();
            foreach (GEP_TESTATA e in dataList)
            {
                l.Add(new GenericListDTO(e.Id_tes_cod_pratica.ToString(), e.Tes_Dt_Arr_Pra.ToShortDateString(), e.Tes_Pariva_Cli + " " + e.Tes_Codfis_Cli, e.Gep_ana_vendi.Ven_ragsoc, e.Gep_ana_serv.Ser_des_servizio, null, null, null, null));
            }
            return l;
        }

        //public static IList<GenericListDTO> transform(DS_snd_risposte dataList)
        //{
        //    IList<GenericListDTO> l = new List<GenericListDTO>();
        //    foreach (DS_snd_risposte.TBL_SND_risposteRow e in dataList.TBL_SND_risposte.Rows)
        //    {
        //        l.Add(new GenericListDTO(e.RIS_piva_mitt.ToString(),e.RIS_piva_mitt.ToString(), e.RIS_cod_disp.ToString(), e.RIS_nome, e.RIS_numero_pratiche.ToString(),  null, null, null, null));
        //    }
        //    return l;
        //}
    }
}
